package com.smartleanx.module.hrm.controller.app.salarynotice.vo;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;

@Schema(description = "用户 APP - 员工工资条通知新增/修改 Request VO")
@Data
public class AppSalaryNoticeSaveReqVO {

    @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18116")
    private Long id;

    @Schema(description = "确认状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    @NotNull(message = "确认状态不能为空")
    private Boolean confirmStatus;

    @Schema(description = "员工反馈")
    private String feedback;

    @JsonIgnore
    @AssertTrue(message = "反馈格式非法")
    public boolean isFeedbackValid(){
        return Boolean.TRUE.equals(confirmStatus) || StrUtil.isNotBlank(feedback);
    }
}